#pragma once

#ifndef __COLOR_H__
#define __COLOR_H__

#include "Common.h"
#include <iostream>

// Set the color of the current output stream.
inline void SetColor(WORD color)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}

// Handler for colors.
class Color
{
public:
	// Construct a Color with a given value.
	Color(WORD value);

	// Constant setter.
	void Set() const;

private:
	WORD m_value;
};

static const Color BLACK(0);
static const Color BLUE(1);
static const Color GREEN(2);
static const Color CYAN(3);
static const Color RED(4);
static const Color MAGENTA(5);
static const Color BROWN(6);
static const Color LIGHTGREY(7);
static const Color DARKGREY(8);
static const Color LIGHTBLUE(9);
static const Color LIGHTGREEN(10);
static const Color LIGHTCYAN(11);
static const Color LIGHTRED(12);
static const Color LIGHTMAGENTA(13);
static const Color YELLOW(14);
static const Color WHITE(15);

// Overload operator << to get SetColor to work.
inline ostream& operator<<(ostream& stream, const Color& color)
{
	color.Set();
	return stream;
}

// Overload operator << to get SetColor to work.
inline wostream& operator<<(wostream& stream, const Color& color)
{
	color.Set();
	return stream;
}

#endif  // __COLOR_H__